package org.chimi.rr4s.domain;

import java.util.Date;

import org.springframework.data.neo4j.annotation.EndNode;
import org.springframework.data.neo4j.annotation.GraphId;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.RelationshipEntity;
import org.springframework.data.neo4j.annotation.StartNode;

@RelationshipEntity
public class Action {

	@GraphId
	private Long graphId;

	@StartNode
	private User user;

	@EndNode
	private Item item;

	@Indexed(indexName = "ACTIONTIME")
	private long actionTimeValue;

	public void setActionTime(Date actionTime) {
		this.actionTimeValue = actionTime.getTime();
	}

	public Long getGraphId() {
		return graphId;
	}

	public User getUser() {
		return user;
	}

	public Item getItem() {
		return item;
	}

	public Date getActionTime() {
		return new Date(actionTimeValue);
	}

}
